import datetime

now_time = datetime.datetime.now()
yes_time = now_time + datetime.timedelta(days=-1)
tom_time = now_time + datetime.timedelta(days=1)
nexthour_time = now_time + datetime.timedelta(hours=1)

# datetime-->str
now_time_str = now_time.strftime("%Y-%m-%d %H:%M:%S")
# str-->datetime
now_time_datetime = datetime.datetime.strptime(now_time_str, "%Y-%m-%d %H:%M:%S")
print(now_time_datetime)